import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

const express = require('express')
const registerRouter = require('./backend/router')

const app = express()
app.listen(9000)
registerRouter(app)
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    port: 7346,
    proxy: {
      '/api': 'http://localhost:9000'
    }
  },
  resolve: {
    alias: [{ find: '@', replacement: '/src' }]
  },
  css: {
    preprocessorOptions: {
      // 全局引入变量和mixin
      scss: {
        additionalData: `
        @import "@/assets/scss/variable.scss";
        @import "@/assets/scss/mixin.scss";
        `
      }
    }
  }
})
